$(function(){
	 var index = 1;
     var len = 5;
     var animated = false;
     var interval = 3000;
     var timer;
     var con=$("#container");
     var l=$("list");
     var btn=$("#button ul li");
    /* var naimate=function(offset){
    	 if(offset==0){
    		 return;
    	 }
    	 animated=true;
    	 var time=300;
    	 var inteval=10;
    	 var speed=offset/(time/inteval);
    	 var left = parseInt(list.style.left) + offset;

         var go = function (){
             if ( (speed > 0 && parseInt(list.style.left) < left) || (speed < 0 && parseInt(list.style.left) > left)) {
                 list.style.left = parseInt(list.style.left) + speed + 'px';
                 setTimeout(go, inteval);
             }
             else {
                 list.style.left = left + 'px';
                 if(left>-1002){
                     list.style.left = -1002 * len + 'px';
                 }
                 if(left<(-1002 * len)) {
                     list.style.left = '-1002px';
                 }
                 animated = false;
             }
         }
         go();
     }*/
     var showButton=function(){
    	 $("#buttons ul li").addClass("current").siblings("li").removeClass("current");
     }
     var play=function(){
    	 timer = setTimeout(function () {
             play();
         }, interval);
     }
     var stop=function(){
    	  clearTimeout(timer);
     }
     $("#buttons ul li").mouseover(function(){
		 var myIndex=$(this).text();
		 
		 showButton();
	 });
     for(var i=0;i<btn.length;i++){
    	
     }
    /* for (var i = 0; i < buttons.length; i++) {
    	
         buttons[i].onclick = function () {
             if (animated) {
                 return;
             }
             if(this.className == 'on') {
                 return;
             }
             var myIndex = parseInt(this.getAttribute('index'));
             var offset = -600 * (myIndex - index);

             animate(offset);
             index = myIndex;
             showButton();
         }
     }*/
     /*container.onmouseover = stop;
     container.onmouseout = play;*/

     play();
});